package com.heima.hellospring.controller;

import com.heima.hellospring.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/student")
public class StudentController {
    @Autowired
    private StudentService studentService;

//    使用thymeleaf显示数据
//    @GetMapping("/list")
//    public String getlist(Model model) {
//        List<Student> students = studentService.findAll();
//        model.addAttribute("students",students);
//          return "/student/list";
//    }


//    使用ajax显示数据
    @GetMapping("/list")
    public String getlist() {
        return "/student/list";
    }
}

